# include <bits/stdc++.h>
# define MAXN 100023
# define mid ((l + r) >> 1)
using namespace std;
inline int gn() {
	int k = 0;
	char c = getchar();
	for(; !isdigit(c); c = getchar());
	for(; isdigit(c); c = getchar()) k = k * 10 + c - '0';
	return k;
}
struct node {
	bool tr;
	node *ls, *rs;
	inline node() {
		ls = rs = NULL;
		tr = 1;
	}
}*root;
node *build(int l, int r) {
	node *x = new node();
	if(l + 1 == r) {
		return x;
	}
	x->ls = build(l, mid);
	x->rs = build(mid, r);
	return x;
}

bool query(node *x, int l, int r, int s, int t) {
	if(s == t) return 1;
	if(l == s && t == r) return x->tr;
	else if(t <= mid) return query(x->ls, l, mid, s, t);
	else if(s >= mid) return query(x->rs, mid, r, s, t);
	else return query(x->ls, l, mid, s, mid) && query(x->rs, mid, r, mid, t);
}
void change(node *x, int l, int r, int k) {
	if(l + 1 == r) {
		x->tr ^= 1;
	} else {
		if(k < mid) change(x->ls, l, mid, k);
		else change(x->rs, mid, r, k);
		x->tr = x->ls->tr && x->rs->tr;
	}
}
int n, m;
bool flag = 1;
int main() {
	freopen("lakee.in", "r", stdin);
	freopen("lakee.out", "w", stdout);
	n = gn();
	m = gn();
	root = build(1, n);
	for(int i = 1; i <= m; i++) {
		if(gn()) {
			int s = gn();
			int t = gn();
			if(t < s) swap(s, t);
			if(query(root, 1, n, s, t) || (flag && query(root, 1, n, 1, s) && query(root, 1, n, t, n))) printf("YES\n");
			else printf("NO\n");
		} else {
			int s = gn();
			int t = gn();
			if(t < s) swap(s, t);
			if(s == 1 && t == n) flag = !flag;
			else change(root, 1, n, s);
		}
	}
}
